import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pornhub_app/components/text_view.dart';
import 'package:pornhub_app/model/engagement/engagement_model.dart';
import 'package:pornhub_app/model/engagement/engagement_station_model.dart';
import 'package:pornhub_app/routes/routes.dart';
import 'package:pornhub_app/utils/color.dart';
import 'package:pornhub_app/utils/extension.dart';
import 'package:pornhub_app/views/engagement/views/engagement_horizontal_list_cell.dart';

class EngagementStationCell extends StatelessWidget {
  EngagementStationModel data;
  List<EngagementModel> engagementList = List<EngagementModel>.of([]);

  EngagementStationCell({super.key, required this.data});

  @override
  Widget build(BuildContext context) {
    engagementList = data.meetList ?? [];
    return Column(
      children: <Widget>[
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
            TextView(
              text: data.stationName ?? '',
              fontSize: 18.w,
              fontWeight: FontWeight.w500,
              color: COLOR.hexColor('#333333'),
              maxLines: 1,
              overflow: TextOverflow.ellipsis,
            ),
            Icon(
              Icons.chevron_right,
              color: COLOR.hexColor('#999999'),
            ).paddingRight(3.w),
          ],
        ).onOpaqueTap(() {
          Get.toEngagementStationMore(
            stationId: data.stationId ?? 0,
            stationName: data.stationName ?? '',
          );
        }).marginOnly(left: 14.w, bottom: 9.w),
        SizedBox(
          height: 260.w,
          child: ListView.builder(
              scrollDirection: Axis.horizontal,
              itemCount: engagementList.length,
              itemBuilder: (context, index) {
                return EngagementHorizontalListCell(
                  data: engagementList[index],
                );
              }).marginOnly(left: 14.w),
        ),
      ],
    ).marginOnly(bottom: 20.w);
  }
}
